package com.heima.api;

import com.heima.model.schedule.dtos.Task;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;

/**
 * 对外暴露的feign接口
 */
@FeignClient("leadnews-schedule")
public interface ScheduleFeignClient {

    /**
     * 添加任务
     * @param task   任务对象
     * @return       任务id
     */
    @PostMapping("/api/v1/schedule/addTask")
    public void addTask(@RequestBody Task task);

    /**
     * 消费任务
     * @param type 类型
     * @param priority  优先级
     */
    @GetMapping("/api/v1/schedule/pullTask/{type}/{priority}")
    public Task pullTask(@PathVariable int type, @PathVariable int priority);
}
